using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using VSTalk.Model;

namespace VSTalk.Engine.Converters
{
    public class InterlocutorStateToColorConverter : IMultiValueConverter
    {
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            var state = (ContactState) value[0];
            if (state == ContactState.Offline)
            {
                return Brushes.DarkGray;
            }

            var showType = (ShowType) value[1];
            switch (showType)
            {
                case ShowType.NONE:
                case ShowType.chat:
                    return Brushes.LightGreen;
                case ShowType.away:
                case ShowType.xa:
                    return Brushes.GreenYellow;
                case ShowType.dnd:
                    return Brushes.Red;
            }
            return null;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            return new object[]
            {};
        }
    }
}